package cn.vendai.com.utils;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * 用户上下文
 * @author Eleven
 */
public class UserTransmittableThreadLocalContext {

    private static final TransmittableThreadLocal<Long> userId = new TransmittableThreadLocal<>();

    public static void setUserId(Long id) {
        userId.set(id);
    }

    public static Long getUserId() {
        return userId.get();
    }

    public static void clear() {
        userId.remove();
    }
}
